import request from "@/api/request.js";

export const getDataService = () => {
  let url = `/api-self/inspection/data`;
  return request.get(url);
};

export const getDataDeService = id => {
  let url = `/api-self/inspection/data/${id}`;
  return request.get(url);
};

export const addDataService = dataObj => {
  let url = `/api-self/inspection/data`;
  return request.post(url, dataObj);
};

//为已有数据组新增数据
export const addForDataService = dataObj => {
  let url = `/api-self/inspection/data/${dataObj.inspectionGroupId}`;
  return request.post(url, dataObj.data);
};

export const editDataNameService = dataObj => {
  let url = `/api-self/inspection/data`;
  return request.put(url, dataObj);
};

//删除数据组
export const delDataService = dataObj => {
  let url = `/api-self/inspection/data/${dataObj.inspectionGroupId}`;
  return request.delete(url);
};

//删除数据组中的数据
export const delDataInDataService = dataObj => {
  let url = `/api-self/inspection/data/detail/${dataObj.groupDetailId}`;
  return request.delete(url);
};
